from moviepy.editor import VideoFileClip


def rotate_video(input_path, output_path):
    # 加载视频
    clip = VideoFileClip(input_path)

    # 顺时针旋转90度
    # 旋转视频时，也可以使用 flip 参数来水平或垂直翻转视频
    rotated_clip = clip.rotate(270, expand=True)

    # 写入新的视频文件
    rotated_clip.write_videofile(output_path, codec='libx264', audio_codec='aac')


# 输入和输出文件路径
input_video = r'I:\003_Material\Data\Porn\短视频\모델 다야7(DAYA), UMC 모터쇼 5차 플윗미(FLY WITH ME)  (UMC X PANDA TV MOTOR SHOW 5TH) (1080p).mp4'
output_video = r'D:\data\모델 다야7(DAYA), UMC 모터쇼 5차 플윗미(FLY WITH ME)  (UMC X PANDA TV MOTOR SHOW 5TH) (1080p).mp4'

# 调用函数
rotate_video(input_video, output_video)

print("Video rotated and saved successfully!")